package com.rd.student.jiaji.class1.wangyufang.day0731;

import java.util.Arrays;

public class TestRandom4 {
    public static void main(String[] args) {
        int[] countArr = new int[20];
        for (int i = 0; i < 20; i++) {
            int n = (int) (Math.random() * 50);
            boolean flag = false;
            for (int j = 0; j < i; j++) {
                if (n == countArr[j]) {
                    flag = true;
                    break;
                }
            }
            if (flag) {
                i--;
                continue;
            }
            countArr[i] = n;

        }
        System.out.println(Arrays.toString(countArr));
    }
}
